<?php
namespace app\home\controller;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Client;
class Bridge extends \think\Controller
{
    public function index()
    {
        $url = $this->request->get('url', '/');
        $this->assign('url', $url);
        $this->assign('meta_desc', 'BTFILM_BTFILM磁力搜索_BTFILM种子搜索_BTFILM影视搜索_BTFILM电影搜索_最新电影_BTFILM搜索');
        $this->assign('meta_keywords', 'BTFILM_BTFILM磁力搜索_BTFILM种子搜索_BTFILM影视搜索_BTFILM电影搜索_最新电影_BTFILM搜索');
        $this->assign('meta_title', 'BTFILM_BTFILM磁力搜索_BTFILM种子搜索_BTFILM影视搜索_BTFILM电影搜索_最新电影_BTFILM搜索');
        return $this->fetch();
    }


    public function douban()
    {
        $url = $this->request->get('url');
        $id = $this->request->get('id');


        $headers = ['referer' => 'https://movie.douban.com/subject/' . $id];
        //$request = new Request('get', $url, $headers);

        $client = new Client([
            'base_uri' => $url,
            'headers' => $headers,
        ]);

        $rp = $client->request('get', $url, $headers);

        header('Cache-control: max-age=864000');
        header('Content-type: image/jpg');
        echo (string) $rp->getBody();
    }
}
